package com.lanou.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by dllo on 18/3/15.
 */
public class TimeTool {
    public static String formatTime(long time){
        Date date = new Date(time);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(date);
    }
    public static long parseTime(String time){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        long result = 0;
        try {
            Date d = sdf.parse(time);
            result = d.getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return result;
    }
}
